package com.woniu.user.feignClient;

import com.woniu.common.annotation.LoginUser;
import com.woniu.common.entity.Result;
import com.woniu.user.pojo.User;
import com.woniu.user.vo.UserLoginVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.math.BigDecimal;
import java.util.List;

@FeignClient(name = "life-user", path = "/user", contextId = "user")
public interface UserFeignClient {

    @GetMapping("/get/{id}")
    public Result<User> getUser(@PathVariable("id") Integer id);

    @GetMapping("/list")
    public Result<List<User>> listUser();

    @GetMapping("/mobile/{mobile}")
    public Result<UserLoginVO> getByMobile(@PathVariable("mobile") String mobile);

    @GetMapping("/updateAmount/{mobile}/{amount}")
    public Result updateAmount(@PathVariable("mobile") String mobile,
                               @PathVariable("amount") BigDecimal amount);

    @GetMapping("/addAmount/{mobile}/{amount}")
    public Result addAmount(@PathVariable("mobile") String mobile,
                            @PathVariable("amount") BigDecimal amount);

    @GetMapping("/updateStoreId/{storeId}/{mobile}")
    @ApiOperation("修改用户表中的商家Id")
    public Result updateStoreId(@PathVariable("storeId") Integer storeId,
                                @PathVariable("mobile") String mobile);
}
